There is no good integration possible between Joomla 1.5/1.6 and Zenphoto 1.3. So i made a dirty hack to do this.
This code shows a random picture from Zenphoto with a link to the gallery. Albums or pictures that are unpublished are excluded.
I use the Jumi Joomla extension to execute php in a Joomla module or article.
2 problems:
1. Images in Zenphoto have to be precached. Can't be fixed because only the original pics are stored in the database.
2. png files don't work.
Explanation:
$num_displayed: The ammount of random pictures to show.
$path: The path to your cache folder
$ext:The last part of the cached images. You have to adjust it to your situation. Just look in de cache directory.
Example: _w595_h446.jpg or something like that.
mysql_query: In the example (see code part) the zenphoto tables are stored in a different database.
Adjust sander1x_oscalbum to the zenphoto database name. And make sure the Joomla database user can also acces to the Zenphoto database. Read rights is enough.
a href: Change it to your Joomla wrapper url
width='240': Adjust this to the desired width.
Code that you put in a Jumi module or article:
`
<?
// Edit this number to however many images you want displaying
$num_displayed = 1 ;
// Zenphoto folder
$path = 'album/cache/' ;
$ext = '_600_osc.jpg' ;
// Select random rows from the database
$result = mysql_query ("SELECT TRIM(TRAILING '.jpg' FROM <code>zp_images.
filename
) as
filename
,
zp_albums
.
folder
FROM
sander1x_oscalbum
.
zp_images
JOIN
sander1x_oscalbum
.
zp_albums
ON
zp_albums
.
id
=
zp_images
.
albumid
WHERE
zp_images
.
filename
NOT LIKE '%.png%' AND
zp_albums
.
show
= '1 ' AND
zp_images
.
show
= '1 '
ORDER BY RAND() LIMIT $num_displayed");
// For all the rows that you selected
while ($row = mysql_fetch_array($result))
{
// Display them to the screen...
echo "
";
}
?>
`
If you have any problems or questions please reply.